<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
    <!-- 
        反转字符和隐藏字符
        v-on表示绑定事情,click表示绑定什么事件
     -->
</head>
<body>
    <div id="root">
        测试
    </div>
    <script>
        const app = Vue.createApp({
            data() {
                return {
                    content: "hello world!",
                }
            },
            methods: {
                btnClick: function() {
                    const newContent = this.content.split('').reverse().join('');
                    this.content = newContent;
                }
            },
            template: `
            <div>
                {{content}}
                <button v-on:click="btnClick">反转</button>
            </div>
            `
        }).mount("#root");
    </script>
</body>
</html>